<template>
    <div class="corn">
        <div class="header">
            <img src="@/images/corn/header.png" alt="">
            <div class="time">
                <div class="icon"><img src="@/images/corn/clock.png" alt=""></div>
                <div class="text">{{ `${state.day} ${state.week} ${state.time}` }}</div>
            </div>
            <div class="title">
                — 玉米长势监测统计平台 —
            </div>
            <div class="tip1">省：</div>
            <div class="tip2">市：</div>
            <div class="select1">吉林省</div>
            <div class="select2">长春省</div>
        </div>
        <div class="contents">
            <div class="left">
                <div class="module module1">
                    <div class="title">
                        <div class="text">监测作物种类统计</div>
                    </div>
                    <div class="content">
                        <div class="l-t-box">
                            <div class="l-t-item" v-for="(v, k) in state.leftTop" :key="k">
                                <div class="l-t-item-icon">
                                    <img :src="v.icon" alt="">
                                </div>
                                <div class="l-t-item-right">
                                    <div class="l-t-item-right-top">
                                        <div class="l-t-item-right-top-num">{{ v.num }}</div>
                                        <div class="l-t-item-right-top-unit">亩</div>
                                    </div>
                                    <div class="l-t-item-right-bottom">
                                        {{ v.name }}
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="module module2">
                    <div class="title">
                        <div class="text">监测田玉米株高趋势</div>
                    </div>
                    <div class="content">
                        <echartsBox  :option="state.leftCenter"></echartsBox>
                    </div>
                </div>
                <div class="module module3">
                    <div class="title">
                        <div class="text">监测田玉米株高趋势</div>
                    </div>
                    <div class="content">
                        <echartsBox  :option="state.leftCenter"></echartsBox>
                    </div>
                </div>
            </div>
            <div class="right">
                <div class="module module1">
                    <div class="title">
                        <div class="text">大气数据（实时观测）</div>
                    </div>
                    <div class="content">
                        <weather :time="state.time"></weather>
                    </div>
                </div>
                <div class="center">
                    <div class="c-left">
                        <div class="title">
                            <div class="text">收支统计</div>
                        </div>
                        <div class="content">
                            <echarts-box :option="state.rightCenterLeft"></echarts-box>
                        </div>
                    </div>
                    <div class="c-right">
                        <div class="title">
                            <div class="text">年产量排名统计</div>
                        </div>
                        <div class="content">
                            <echarts-box :option="state.rightCenterRight"></echarts-box>
                        </div>
                    </div>
                </div>
                <div class="bottom">
                    <div class="b-left">
                        <div class="title">
                            <div class="text">统计信息</div>
                        </div>
                        <div class="content">
                            <div class="box" style="width:100%;height:240px;overflow:hidden">
                                <tableList :rows="state.rightBottomLeft.tableRows"
                                    :columns="state.rightBottomLeft.tableColumns"
                                    :headerStyle="{ background: '#173c61' }">
                                </tableList>
                            </div>
                        </div>
                    </div>
                    <div class="b-right">
                        <div class="title">
                            <div class="text">经济状况</div>
                        </div>
                        <div class="content">
                            <echarts-box  :option="state.rightBottomRight"></echarts-box>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>
<script setup>
import moment from 'moment'
import echartsBox from '@/components/echarts-box.vue'
import tableList from '@/components/table.vue'
import List from '@/components/list.vue'
import { onMounted, reactive } from 'vue-demi'
import { leftTop, leftCenter, rightCenterLeft, rightCenterRight, rightBottomLeft, rightBottomRight } from './planeData'
import weather from './weather.vue'

const state = reactive({
    time: '',
    day: '',
    week: '',
    leftTop,
    leftCenter,
    rightCenterLeft,
    rightCenterRight,
    rightBottomLeft,
    rightBottomRight,
    select1: '1'
})
const getWeek = (number) => {
    switch (number) {
        case 1:
            return '星期一';
        case 2:
            return '星期二';
        case 3:
            return '星期三';
        case 4:
            return '星期四';
        case 5:
            return '星期五';
        case 6:
            return '星期六';
        case 7:
            return '星期日';
    }
}
const getTime = () => {
    state.day = moment().format('YYYY-MM-DD')
    state.time = moment().format('HH:mm')
    state.week = getWeek(moment().isoWeekday())
}
onMounted(() => {
    getTime()
    setInterval(() => {
        getTime()
    }, 60000)
})
</script>
<style lang="scss" scoped>
.title {
    background: url(@/images/corn/title.png) no-repeat;
    background-size: 100% 100%;
    height: 50px;
    position: relative;
    width: 337px;
    .text {
        font-size: 18px;
        position: absolute;
        left: 30%;
        top: 50%;
        transform: translateY(-60%);
    }
}

.corn {
    width: 100vw;
    height: 100vh;
    color: #fff;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #000;

    .header {
        position: relative;
        margin-bottom: -3%;

        img {
            width: 100%;
            object-fit: contain;
        }

        .time {
            position: absolute;
            left: 3%;
            top: 25%;
            display: flex;
            align-items: center;
            color: #2EB8FF;
            font-size: 14px;

            .icon {
                margin-right: 10px;
                display: flex;
                align-items: center;

                img {
                    width: 14px;
                    object-fit: contain;
                }
            }
        }

        .title {
            position: absolute;
            width: 70%;
            left: 50%;
            transform: translateX(-50%);
            top: 15%;
            font-size: 30px;
            font-family: Microsoft YaHei;
            font-weight: bold;
            color: #FFFFFF;
            text-shadow: 2px 5px 0px rgba(0, 0, 255, 0.52);
            // background: linear-gradient(0deg,#fff 0%, #AFC6F5 90%);
            // -webkit-background-clip: text;
            display: flex;
            justify-content: center;
            align-items: center;
            // -webkit-text-fill-color: transparent;
        }

        .tip1 {
            position: absolute;
            right: 23%;
            top: 28%;
            font-size: 20px;
        }

        .tip2 {
            position: absolute;
            right: 10%;
            top: 28%;
            font-size: 20px;
        }

        .select1 {
            position: absolute;
            right: 18%;
            top: 28%;
            font-size: 20px;
        }

        .select2 {
            position: absolute;
            right: 5%;
            top: 28%;
            font-size: 20px;
        }
    }

    .contents {
        padding: 0 20px 20px;
        // margin-top: -20px;
        position: relative;
        // top: -60px;
        flex: 1;
        display: flex;
        overflow: hidden;

        .left {
            height: 100%;
            width: 520px;
            display: flex;
            margin-right: 20px;
            ;
            flex-direction: column;

            .module {
                // height: 33%;
                margin-top: 20px;
                flex: 1;

                &:first {
                    margin-top: 0;
                }

                display: flex;
                flex-direction: column;
                background: url(@/images/corn/box.png) no-repeat;
                background-size: 100% 100%;

                // margin-top: 10px;;
                .content {
                    padding: 20px;

                }
            }

            .module1 {
                flex:0;

                .content {
                    .l-t-box {
                        display: flex;
                        flex-wrap: wrap;

                        .l-t-item {
                            width: 33%;
                            display: flex;
                            align-items: center;
                            margin-bottom: 10px;

                            .l-t-item-icon {
                                margin-right: 10px;
                                ;

                                img {
                                    width: 50px;
                                    object-fit: contain;
                                }
                            }

                            .l-t-item-right {
                                // color: #2EB8FF;
                                background: url(@/images/corn/plane/textbg.png) no-repeat;
                                background-size: 100% 100%;
                                padding: 4px 10px;
                                color: #2FC6DC;

                                .l-t-item-right-top {
                                    display: flex;
                                    // align-items: flex-start;

                                    .l-t-item-right-top-num {
                                        font-size: 30px;
                                        font-weight: 600;
                                        vertical-align: bottom;
                                        position: relative;
                                        top: 6px;
                                        font-weight: bolder;
                                        background-image: linear-gradient(#e2f0fe, #2b92b8);
                                        -webkit-background-clip: text;
                                        color: transparent;
                                        display: flex;
                                        justify-content: center;
                                        align-items: center;
                                    }

                                    .l-t-item-right-top-unit {
                                        margin-left: 5px;
                                        font-size: 16px;
                                        // align-self: flex-end;
                                        position: relative;
                                        top: 10px;
                                    }
                                }

                                .l-t-item-right-bottom {
                                    margin-top: 10px;
                                    font-size: 12px;
                                }

                            }
                        }
                    }
                }

            }

            .module2,
            .module3 {

                .content {
                    flex: 1;
                }
            }
        }

        .right {
            flex: 1;
            display: flex;
            height: 100%;
            ;
            flex-direction: column;

            .module {
                background: url(@/images/corn/box.png) no-repeat;
                background-size: 100% 100%;
                flex: 1;
                margin-top: 20px;
            }

            .module1 {
                display: flex;
                flex-direction: column;
                ;

                // padding: 240px;
                .content {
                    flex: 1;
                    padding: 0 20px;
                }
            }

            .center,
            .bottom {
                flex: 1;
                display: flex;

                .c-left,
                .c-right,
                .b-left,
                .b-right {
                    flex: 1;
                    background: url(@/images/corn/box.png) no-repeat;
                    background-size: 100% 100%;
                    display: flex;
                    flex-direction: column;

                    .content {
                        flex: 1;
                        padding: 0 20px;
                        ;
                    }
                }

                .c-left,
                .b-left {
                    margin-right: 20px;
                }
            }

            .center {
                margin: 20px 0;
            }
        }
    }
}
</style>